const router = require('koa-router')()
const {patchReply, postReply, deleteReply} = require('../../controller/reply')

router.prefix('/api/reply')

router.post('/reply', async (ctx, next) => {
  const {content, contentId} = ctx.request.body
  ctx.body = await postReply(ctx, {content, contentId})
})

router.patch('/reply', async (ctx, next) => {
  const {content, id} = ctx.request.body
  ctx.body = await patchReply({content, id})
})

router.delete('/reply/:id', async (ctx, next) => {
  const {id} = ctx.params
  ctx.body = await deleteReply(id)
})

module.exports = router
